package java_1_21;

import java.lang.reflect.Field;

/**
 * @author 美女
 * @date 2022/03/22 23:12
 **/
public class Message<T extends Number> {
    private T msg;

    public T getMsg() {
        return msg;
    }

    public void setMsg(T msg) {
        this.msg = msg;
    }

    public static void main(String[] args) throws NoSuchFieldException {
        Message<Integer> msg1=new Message<>();
        Message<Double> msg2=new Message<>();
        Field field1=msg1.getClass().getDeclaredField("msg");
        Field field2=msg2.getClass().getDeclaredField("msg");
        System.out.println(field1.getType());
        System.out.println(field2.getType());
    }
    private static void fun(Message<? super Double> msg) {
        System.out.println(msg.getMsg());
        msg.setMsg(123.0);
    }
}
